package com.leung.service.impl;


import com.leung.dao.EmployeeDao;
import com.leung.dao.po.Employee;
import com.leung.service.EmployeeService;
import lombok.RequiredArgsConstructor;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.stereotype.Service;

/**
 * @author 丨一
 * @version 1.0
 * @title EmployeeServiceImpl
 * @description:
 * @date 2025/9/28 下午5:36
 */
@Service
@RequiredArgsConstructor
public class EmployeeServiceImpl implements EmployeeService {

    private final EmployeeDao employeeDao;

    @Override
    public boolean addEmployee(Employee employee) {

        if (null == employee.getName() || null == employee.getPhoneNumber() || null == employee.getAge()) {
            throw new RuntimeException("数据非法");
        }

        int insert = employeeDao.insert(employee);

        if (insert <= 0) {
            throw new RuntimeException("插入失败");
        }

        return true;

    }
}
